//
//  PostTypeViewController.m
//  ZhuanZuBao
//
//  Created by bchy on 2020/8/31.
//  Copyright © 2020 戴伟. All rights reserved.
//

#import "PostTypeViewController.h"
#import "PostTypeCell.h"
#import "PostViewController.h"


@interface PostTypeViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) IBOutlet UIView *footerView;
@property (strong, nonatomic) IBOutlet UIView *headerView;

@end

@implementation PostTypeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"发布选择";
    self.headerView.frame = CGRectMake(0, 0, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_WIDTH*0.4133);
    self.tableView.tableFooterView = self.footerView;
    self.tableView.tableHeaderView = self.headerView;
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    PostTypeCell *cell = [PostTypeCell cellWithTableView:tableView];
    if (indexPath.row == 0) {
        [cell setImage:@"postType1" title:@"个人转租" subTitle:@"个人转租住宅房屋"];
    }else if (indexPath.row == 1){
        [cell setImage:@"postType2" title:@"公司转租" subTitle:@"公司转租住宅房屋"];
    }else if (indexPath.row == 2){
        [cell setImage:@"postType3" title:@"中介转租" subTitle:@"中介转租住宅房屋"];
    }else if (indexPath.row == 3){
        [cell setImage:@"postType4" title:@"急转租" subTitle:@"好房源好房源好房源好房源"];
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    PostViewController *vc = [PostViewController new];
    [self.navigationController pushViewController:vc animated:YES];
    if (indexPath.row == 0) {
        vc.postType = @"23";
    }else if (indexPath.row == 1){
        vc.postType = @"24";
    }else if (indexPath.row == 2){
        vc.postType = @"25";
    }
}
@end
